package com.sgb.kjwl.view.ui.adapter.enterprise;

import android.content.Context;

import com.sgb.kjwl.BR;
import com.sgb.kjwl.R;
import com.sgb.kjwl.databinding.ItemServiceprojectclassLabelBinding;
import com.sgb.kjwl.model.entity.enterprise.ServiceProjectClassEntity;
import com.swgk.core.recyclerview.adapter.BaseRecycleAdapter;
import com.swgk.core.recyclerview.adapter.ItemViewHolder;

import java.util.List;

public class ServiceProjectClassListLabelAdpater extends BaseRecycleAdapter<ServiceProjectClassEntity.ChildBean> {
    ServiceProjectClassListAdpater.ClickLister lister;
    int position;

    public ServiceProjectClassListLabelAdpater(Context context, List<ServiceProjectClassEntity.ChildBean> datas, int position, ServiceProjectClassListAdpater.ClickLister lister) {
        super(context, R.layout.item_serviceprojectclass_label, datas);
        this.position = position;
        this.lister = lister;
    }

    @Override
    public void convert(ItemViewHolder holder, ServiceProjectClassEntity.ChildBean childBean) {
        holder.setBinding(BR.mModel,childBean);
        if(holder.getmBinding() instanceof ItemServiceprojectclassLabelBinding&&lister!=null){
            ((ItemServiceprojectclassLabelBinding) holder.getmBinding()).imageDeleteLabel.setOnClickListener(view ->lister.onclick(view,position,holder.getIndex_position()));
            ((ItemServiceprojectclassLabelBinding) holder.getmBinding()).imageUpdateLabel.setOnClickListener(view ->lister.onclick(view,position,holder.getIndex_position()));
        }
    }
}
